package com.cos.hospital.model.retrofit;


import com.cos.hospital.code.Code;
import com.cos.hospital.dao.beandao.DbAcupoint;
import com.cos.hospital.dao.beandao.DbCure;
import com.cos.hospital.dao.beandao.DbElement;
import com.cos.hospital.dao.beandao.DbMeridian;
import com.cos.hospital.model.bean.ApkInfo;
import com.cos.hospital.model.bean.BedBean;
import com.cos.hospital.model.bean.CureInfo;
import com.cos.hospital.model.bean.CureProjectBean;
import com.cos.hospital.model.bean.HistoryRecordsBean;
import com.cos.hospital.model.bean.ImageBean;
import com.cos.hospital.model.bean.MessageListBean;
import com.cos.hospital.model.bean.PatientFile;
import com.cos.hospital.model.bean.PatientInfoBean;
import com.cos.hospital.model.bean.PatientListBean;
import com.cos.hospital.model.bean.RecordWebBean;
import com.cos.hospital.model.bean.ResultBean;
import com.cos.hospital.model.bean.ResultListBean;
import com.cos.hospital.model.bean.SurplusCureBean;
import com.cos.hospital.model.bean.TemplateListBean;
import com.cos.hospital.model.bean.UploadBean;
import com.cos.hospital.model.bean.user.AssisBean;
import com.cos.hospital.model.bean.user.CodeBean;
import com.cos.hospital.model.bean.user.MyAssisBean;
import com.cos.hospital.model.bean.user.SchDefaultBean;
import com.cos.hospital.model.bean.user.SchMineBean;
import com.cos.hospital.model.bean.user.SessionBean;
import com.cos.hospital.model.bean.user.TokenBean;
import com.cos.hospital.model.bean.user.UserInfoBean;
import com.cos.hospital.model.bean.user.UserMsgBean;
import com.cos.hospital.ui.patient.compare.bean.RecordListBean;
import com.cos.hospital.ui.patient.compare.bean.TimesBean;
import com.google.gson.JsonObject;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

/**
 * Created by yby on 2016/10/18
 */
public interface RequestServes {
    //获取token
    @FormUrlEncoded
    @POST(Code.Link.UserToken)
    Observable<TokenBean> getToken(@Field("grant_type") String grant_type,
                                   @Field("client_id") String client_id,
                                   @Field("scope") String scope,
                                   @Field("client_secret") String client_secret,
                                   @Field("username") String username,
                                   @Field("password") String password);

    //查询数据库版本
    @POST(Code.Link.ResCheckDB)
    Observable<ResultBean<Integer>> getCheckDB(@Body String json);

    //查询穴位数据
    @POST(Code.Link.ResAcupoint)
    Observable<ResultListBean<DbAcupoint>> getAcupointDB(@Body String json);

    //查询元素信息
    @POST(Code.Link.ResElement)
    Observable<ResultListBean<DbElement>> getElementDB(@Body String json);

    //查询经络数据
    @POST(Code.Link.ResMeridian)
    Observable<ResultListBean<DbMeridian>> getMeridianDB(@Body String json);

    //查询治疗项目数据
    @POST(Code.Link.ResCure)
    Observable<ResultListBean<DbCure>> getCureDB(@Body String json);

    //发送手机验证码
    @POST(Code.Link.UserPhoneCode)
    Observable<ResultBean<CodeBean>> getVerificationCode(@Body JsonObject jsonObject);

    //修改密码
    @POST(Code.Link.UserPwd)
    Observable<ResultBean> resetPassword(@Body JsonObject jsonObject);

    //获取当前用户的session
    @POST(Code.Link.UserSession)
    Observable<ResultBean<SessionBean>> getUserSession(@Body JsonObject jsonObject);

    //获取APK版本信息
    @POST(Code.Link.GetApkVersion)
    Observable<ResultBean<ApkInfo>> getApkVersion(@Body JsonObject jsonObject);

    //我的资料
    @POST(Code.Link.UserInfo)
    Observable<ResultBean<UserInfoBean>> getUserInfo(@Body JsonObject jsonObject);

    //我的助理
    @POST(Code.Link.AssistMine)
    Observable<ResultListBean<MyAssisBean>> getMyAssist(@Body JsonObject jsonObject);

    //新增助理
    @POST(Code.Link.AssistCreat)
    Observable<ResultBean> getMyAssistCreat(@Body JsonObject jsonObject);

    //查询助理信息
    @POST(Code.Link.AssistSearch)
    Observable<ResultBean<AssisBean>> assistSearch(@Body JsonObject jsonObject);

    //修改助理
    @POST(Code.Link.AssistEdit)
    Observable<ResultBean> assistEdit(@Body JsonObject jsonObject);

    //排班查询
    @POST(Code.Link.ScheduleSearch)
    Observable<ResultBean<SchMineBean>> getSchedule(@Body JsonObject jsonObject);

    //创建+修改排班
    @POST(Code.Link.ScheduleCreat)
    Observable<ResultBean> getScheduleSave(@Body JsonObject jsonObject);

    //默认排班查询
    @POST(Code.Link.ScheduleDefaultSearch)
    Observable<ResultBean<SchDefaultBean>> getScheduleDefault(@Body JsonObject jsonObject);

    //创建+修改默认排班
    @POST(Code.Link.ScheduleDefaultChange)
    Observable<ResultBean> getScheduleDefaultSave(@Body JsonObject jsonObject);

    //消息中心
    @POST(Code.Link.MsgMine)
    Observable<ResultBean<UserMsgBean>> getMsgCenter(@Body JsonObject jsonObject);

    //患者列表查询(接诊管理列表)
    @POST(Code.Link.PatientVisitingList)
    Observable<ResultBean<PatientListBean>> getVisitingList(@Body JsonObject jsonObject);

    //患者列表查询(患者管理列表)
    @POST(Code.Link.PatientList)
    Observable<ResultBean<PatientListBean>> getPatientList(@Body JsonObject jsonObject);

    //查询治疗列表
    @POST(Code.Link.CureList)
    Observable<ResultBean<PatientListBean>> getCureList(@Body JsonObject jsonObject);

    //患者建档
    @POST(Code.Link.PatientCreat)
    Observable<ResultBean<Integer>> patientCreat(@Body JsonObject jsonObject);

    //患者档案查询
    @POST(Code.Link.PatientInfoSearch)
    Observable<ResultBean<PatientInfoBean>> patientInfoSearch(@Body JsonObject jsonObject);

    //患者档案查询
    @POST(Code.Link.PatientFileSearch)
    Observable<ResultBean<PatientFile>> patientFileSearch(@Body JsonObject jsonObject);

    //修改患者信息
    @POST(Code.Link.PatientInfoEdit)
    Observable<ResultBean> patientInfoEdit(@Body JsonObject jsonObject);

    //发送消息查询
    @POST(Code.Link.MsgSearch)
    Observable<ResultBean<MessageListBean>> msgSearch(@Body JsonObject jsonObject);

    //发送消息
    @POST(Code.Link.MsgSend)
    Observable<ResultBean> msgSend(@Body JsonObject jsonObject);

    //历史病历查询
    @POST(Code.Link.QueryMedicalRecordList)
    Observable<ResultBean<HistoryRecordsBean>> queryMedicalRecordList(@Body JsonObject jsonObject);

    //患者病历查询
    @POST(Code.Link.QueryMedicalRecordInfo)
    Observable<ResultBean<RecordWebBean>> queryMedicalRecordInfo(@Body JsonObject jsonObject);

    //查询元素模板
    @POST(Code.Link.QueryElementTemplate)
    Observable<ResultBean<TemplateListBean>> getElementTemplate(@Body JsonObject jsonObject);

    //更新模板使用次数
    @POST(Code.Link.UpdateElementTemplate)
    Observable<JsonObject> updateElementTemplate(@Body JsonObject jsonObject);

    //补充病例查询
    @POST(Code.Link.QueryMedicalSupplement)
    Observable<ResultListBean<TimesBean>> queryMedicalSupplement(@Body JsonObject jsonObject);

    //查询有病历的日期
    @POST(Code.Link.QueryMedicalWithDate)
    Observable<ResultBean<RecordListBean>> queryMedicalWithDate(@Body JsonObject jsonObject);

    //查询患者治疗信息(针灸方案)
    @POST(Code.Link.CureInfo)
    Observable<ResultBean<CureInfo>> queryCureInfo(@Body JsonObject jsonObject);

    //查询患者治疗信息(床位信息查询)
    @POST(Code.Link.QUERY_BED_INFO)
    Observable<ResultBean<List<BedBean>>> queryBedInfo(@Body JsonObject jsonObject);

    //病历保存(可同时签到接诊)
    @POST(Code.Link.SaveMedical)
    Observable<ResultBean<Integer>> saveMedical(@Body JsonObject jsonObject);

    //保存元素
    @POST(Code.Link.SaveMedicalElement)
    Observable<ResultBean<RecordWebBean.MedicalElementBean>> saveMedicalElement(@Body JsonObject jsonObject);

    //添加患者治疗(开始治疗/继续接诊/保存)
    @POST(Code.Link.CureStart)
    Observable<ResultBean<RecordWebBean.MedicalElementBean>> cureStart(@Body Map<String, Object> map);

    //治疗结束
    @POST(Code.Link.CureFinish)
    Observable<ResultBean> cureFinish(@Body JsonObject jsonObject);

    //保存元素（图片）
    @POST(Code.Link.SaveMedicalImage)
    Observable<ResultListBean<ImageBean>> saveMedicalImage(@Body Map<String, Object> map);

    //保存元素（月经史公式）
    @POST(Code.Link.SaveMedicalMHF)
    Observable<ResultBean<RecordWebBean.MhfBean>> saveMedicalMHF(@Body Map<String, Object> map);

    //保存元素（生育史公式）
    @POST(Code.Link.SaveMedicalRHF)
    Observable<ResultBean<RecordWebBean.RhfBean>> saveMedicalRHF(@Body Map<String, Object> map);

    //删除元素
    @POST(Code.Link.DeleteMedicalElement)
    Observable<ResultBean> deleteMedicalElement(@Body JsonObject jsonObject);

    //删除月经史公式
    @POST(Code.Link.DeleteMedicalMHF)
    Observable<ResultBean> deleteMedicalMHF(@Body JsonObject jsonObject);

    //删除生育史公式
    @POST(Code.Link.DeleteMedicalRHF)
    Observable<ResultBean> deleteMedicalRHF(@Body JsonObject jsonObject);

    //治疗项目查询
    @POST(Code.Link.CureProjectSearch)
    Observable<ResultListBean<CureProjectBean>> cureProjectSearch(@Body JsonObject jsonObject);

    //剩余患者治疗项目查询
    @POST(Code.Link.SurplusCureList)
    Observable<ResultBean<SurplusCureBean>> getSurplusCureList(@Body JsonObject jsonObject);

    //患者治疗项目修改增加
    @POST(Code.Link.CurePatientAdd)
    Observable<ResultBean> curePatientAdd(@Body Map<String, Object> map);

    //文件上传
    @Multipart
    @POST(Code.Link.ResUpload)
    Observable<ResultBean<UploadBean>> resUpload(@Part MultipartBody.Part part);

    @Streaming
    @GET
    Observable<ResponseBody> downFile(@Url String fileUrl);

}
